package com.prd.controller;

import com.prd.model.EntMeetRecord;
import com.prd.model.EntMeetSign;
import com.prd.service.EntMeetRecordService;
import com.prd.service.EntMeetSignService;
import com.prd.util.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = {"会议签到/请假"})
@RestController
@RequestMapping("api/entMeetSign")
public class EntMeetSignController extends BaseController {

    @Autowired
    private EntMeetSignService entMeetSignService;

    @ApiOperation("添加请假信息")
    @PostMapping(value = "add", produces = "application/json;charset=UTF-8")
    public AjaxResult add(@RequestBody EntMeetSign entMeetSign) {
        return toAjax(entMeetSignService.insertLeaveInfo(entMeetSign));
    }

    @ApiOperation("修改请假信息")
    @PostMapping(value = "update", produces = "application/json;charset=UTF-8")
    public AjaxResult update(@RequestBody EntMeetSign entMeetSign) {
        return toAjax(entMeetSignService.updateInfo(entMeetSign));
    }

    @ApiOperation("查询请假详情")
    @GetMapping(value = "details/{meetId}", produces = "application/json;charset=UTF-8")
    public AjaxResult details(@PathVariable("meetId") Long meetId) {
        return AjaxResult.success(entMeetSignService.details(meetId));
    }

    @ApiOperation("取消请假信息")
    @PostMapping(value = "cancel/{id}", produces = "application/json;charset=UTF-8")
    public AjaxResult cancel(@PathVariable("id") Long id) {
        return toAjax(entMeetSignService.cancel(id));
    }

}
